home *** CD-ROM | disk | FTP | other *** search
/ NOVA - For the NeXT Workstation / NOVA - For the NeXT Workstation.iso / Documents / NeXTAnswers / postscript.796 < prev    next >
Text File  |  1992-02-06  |  3KB  |  61 lines

  1. {\rtf0\ansi{\fonttbl\f0\fnil Times-Roman;\f3\fmodern Ohlfs;\f1\fswiss Helvetica;}
  2. \paperw13040
  3. \paperh10800
  4. \margl120
  5. \margr120
  6. {\colortbl\red0\green0\blue0;}
  7. \pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\f0\b0\i0\ul0\fs28\fc0 PostScript userobjects operands
  8. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600 \
  9. \
  10. Q:  I'm using 
  11. \b PScountscreenlist
  12. \b0  and 
  13. \b PSscreenlist
  14. \b0  to get the global window numbers for all of the windows on the screen.  Then, I pass the window numbers to 
  15. \b PScurrentwindowbounds
  16. \b0  to get the size of each window.  However, I'm getting DPS errors.  What am I doing wrong?\
  17. \
  18. A:  There are many PostScript wraps that require 
  19. \i userobjects
  20. \i0  for arguments which represent windows—
  21. \b PScurrentwindowbounds
  22. \b0  is one of these.  There are many other PostScript wraps which return values that represent windows whose type is an integer—
  23. \b PSscreenlist
  24. \b0  is one of these.  Thus the return values that you get from 
  25. \b PSscreenlist
  26. \b0  cannot serve directly as arguments for 
  27. \b PScurrentwindowbounds
  28. \b0 .\
  29. \
  30. You must either convert non-userobjects to a userobject before passing it to the next PostScript operator, or you must write your own wrap which takes window arguments as a type int.  In the example stated in the question above it would be best to write your own wrap to replace 
  31. \b PScurrentwindowbounds
  32. \b0 .\
  33. \
  34. It would look like this:\
  35.  
  36. \f3\fs22 \
  37.  
  38. \pard\tx620\tx1240\tx1860\tx2480\tx3100\tx3720\tx4340\tx4980\tx5600\tx6220     defineps MYcurrentwindowbounds(int num | float *x, *y, *w, *h)\
  39.         num currentwindowbounds h w y x\
  40.     endps\
  41.  
  42. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\f0\fs28\fc0 \
  43.  
  44. \pard\tx620\tx1240\tx1860\tx2480\tx3100\tx3720\tx4340\tx4980\tx5600\tx6220\fc0 You can also create a userobject using 
  45. \b DPSDefineUserObject()
  46. \b0  to pass into the wrap.  However, you should only make a userobject if you are going to use it several times in your program.  Remember when using 
  47. \b DPSDefineUserObject
  48. \b0  to pass it an index of 0.  This indicates to the client library to return the next available userobject.  If you pass it a value of your own choosing, you may clobber one that already exists.\
  49. \
  50.  
  51. \pard\tx1340\tx2680\tx4020\tx5360\tx6720\tx8060\tx9400\tx10740\tx12080\tx13440\fc0 User objects are the numbers that you get in event records and when you ask a Window object for its number.  Really they are more the rule than the exception.\
  52.  
  53. \pard\tx620\tx1240\tx1860\tx2480\tx3100\tx3720\tx4340\tx4980\tx5600\tx6220\fc0 \
  54.  
  55. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\fc0 QA796\
  56. \
  57. Valid for 1.0\
  58. Valid for 2.0\
  59. \
  60.  
  61.